<template>
  <div>
    <Tab :count="count" ref="now" />
    <Headers :thing="count" :add="add" />
    <button @click="add">增加</button>
  </div>
</template>

<script>
import Headers from "./page/Header.vue";
import Tab from "./page/Tab.vue";
export default {
  name: "App",
  components: { Headers, Tab },
  data() {
    return {
      count: 0,
    };
  },
  methods: {
    add() {
      this.count++;
    },
    Rep(count) {
      this.count = count;
    },
  },
  mounted() {
    // 给ref为now的添加一个事件 第一个参数是添加的事件
    this.$refs.now.$on("numData", this.Rep);
  },
};
</script>

<style>
</style>